<include file="public@header"/>

</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('PreStudent/index')}">预选课分析</a></li>
    </ul>
    <form class="well form-inline margin-top-20 row" method="post" action="{:url('PreStudent/index')}">
        <label class="col-md-3 col-sm-6  form-group">
            所属校区:
            <select class="form-control" name="school_id" id="school_id">
                <option value='0'>全部</option>
                <notempty name="school_data">
                    <volist name="school_data" id="vo">
                        <if condition="isset($param.school_id) && $param.school_id == $vo.id">
                            <option value="{$vo.id}" selected>{$vo.name}</option>
                            <else/>
                            <option value="{$vo.id}">{$vo.name}</option>
                        </if>
                    </volist>
                </notempty>
            </select>
        </label>
        <label class="col-md-3 col-sm-6  form-group">
            课程：
            <select class="form-control" name="course_id" id="student_status">
                <option value="0">全部</option>
                <notempty name="course_data">
                    <volist name="course_data" id="vo">
                        <if condition="isset($param.course_id) && $param.course_id == $vo.id">
                             <option value="{$vo.id}" selected >{$vo.course_name}</option>
                            <else/>
                            <option value="{$vo.id}">{$vo.course_name}</option>
                        </if>
                    </volist>
                </notempty>
            </select>
        </label>

        <label class="col-md-3 col-sm-6  form-group">
            <input type="submit"  class="btn btn-primary" value="搜索"/>
            <a class="btn btn-danger" href="{:url('PreStudent/index')}">清空</a>
        </label>
    </form>
</div>
<!--生成表的地方-->
<div id="main" style="width: 600px;height:400px;" class="center-block"></div>
<!--table-->
<div id="table"  class="row col-lg-8 center-block ">
    <table class="table table-bordered h4 ">
        <tr>
            <td class='col-md-3 right-align'>
                预选人数：
            </td>
            <td>
                {$data_tui}
            </td>
        </tr>
        <tr>
            <td>
                报名人数：
            </td>
            <td>
                {$data_all}
            </td>
        </tr>
        <tr>
            <td>
                预选课程转化率：
            </td>
            <td>
                {$tui}
            </td>
        </tr>

    </table>

</div>


<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript" src="__STATIC__/js/echarts.js"></script>
<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
<script type="text/javascript">

    var data="{$data_tui}";
    data = JSON.parse(data);//转换为json对象

    var data_all="{$data_all}";
    data_all = JSON.parse(data_all);//转换为json对象

    bottom_name=[];
    ratio=[];
    for(var i in data)
    {
        bottom_name.push(data[i].cname);
        if(data[i].total_student===0)
        {
            ratio.push(0);
        }else{
            $ratio=parseFloat(data[i].current_num/data[i].total_student).toFixed(2);
            ratio.push($ratio);
        }
    }
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));
    option = {
        title : {
            text: '预选课程转化统计',
//            subtext: '详情',
            x:'center'
        },
        tooltip : {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            data: ['退班人数','总人数']
//            data: ['直接访问','邮件营销','联盟广告','视频广告','搜索引擎']

        },
        series : [
            {
                name: '访问来源',
                type: 'pie',
                radius : '55%',
                center: ['50%', '60%'],
                data:[
                    {value:data, name:'预选报名人数('+data+')'},
                    {value:data_all-data, name:'预选未报名人数('+parseInt(data_all-data)+')'},
                ],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };

    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);


</script>
</body>
</html>